package com.mdl.book.manager;

import java.sql.*;

import com.mdl.book.util.*;
public class loginManager {
	
	public boolean checkLogin(admin a){
		boolean b = false;
		String sql = "select * from admin where username = ? and userpassword = ?";
		Connection conn = DB.getConn();
		PreparedStatement stmt = null;
		ResultSet rs = null;
		try{
			stmt = conn.prepareStatement(sql);
			stmt.setString(1,a.getUserName());
			stmt.setString(2,a.getUserPassword());
			rs = stmt.executeQuery();
			if(rs.next()){
				b = true;
			}
		}catch(SQLException e){
			e.printStackTrace();
			b = false;
		}finally{
			DB.closeResultSet(rs);
			DB.closeStmt(stmt);
			DB.closeConn(conn);
		}
		return b;
	}
}
